CC = gcc
CFLAGS = -Wall -Werror

# Librarys
INCLUDE = -I /usr/local/include -I/usr/include/mysql
LDFLAGS = -L /usr/local/lib -L/usr/lib/mysql
LDLIBS = -lcurl -lmysqlclient

# Details
SOURCES = Parsing/Parsing.c WebInterface/Private/urlio.c WebInterface/WebInterface.c Tools/linked_list.c SQLInterface/SQLInterface.c SQLInterface/Tuple.c Tools/Sort.c SQLInterface/Database.c SQLInterface/Private/sql.c
INITIALPOP = InitialPopulate.c
INITIALSTATS = InitialStats.c
TEST = TestSuite.c Tests/ParseSymbolsTest.c Tests/StatsTests.c Tests/SQLTests.c

#outNames
INITIALPOPOUT = InitialPopulate
INITIALSTATSOUT = InitialStats
TESTOUT = test

all: build

build: $(SOURCES) $(INITIALPOP) $(TEST) $(INITIALSTATS)
	$(CC) -o $(INITIALPOPOUT) $(INCLUDE) $(CFLAGS) $(LDFLAGS) $(SOURCES) $(INITIALPOP) $(LDLIBS)
	$(CC) -o $(TESTOUT) $(INCLUDE) $(CFLAGS) $(LDFLAGS) $(SOURCES) $(TEST) $(LDLIBS)
	$(CC) -o $(INITIALSTATSOUT) $(INCLUDE) $(CFLAGS) $(LDFLAGS) $(SOURCES) $(INITIALSTATS) $(LDLIBS)

initial: $(SOURCES) $(INITIALPOP) $(INITIALSTATS)
	$(CC) -o $(INITIALPOPOUT) $(INCLUDE) $(CFLAGS) $(LDFLAGS) $(SOURCES) $(INITIALPOP) $(LDLIBS)
	$(CC) -o $(INITIALSTATSOUT) $(INCLUDE) $(CFLAGS) $(LDFLAGS) $(SOURCES) $(INITIALSTATS) $(LDLIBS)

initialpop: $(SOURCES) $(INITIALPOP) 
	$(CC) -o $(INITIALPOPOUT) $(INCLUDE) $(CFLAGS) $(LDFLAGS) $(SOURCES) $(INITIALPOP) $(LDLIBS)
	
initialstats: $(SOURCES) $(INITIALSTATS)
	$(CC) -o $(INITIALSTATSOUT) $(INCLUDE) $(CFLAGS) $(LDFLAGS) $(SOURCES) $(INITIALSTATS) $(LDLIBS)

test: $(SOURCES) $(TEST)
	$(CC) -o $(TESTOUT) $(INCLUDE) $(CFLAGS) $(LDFLAGS) $(SOURCES) $(TEST) $(LDLIBS)
